package string;

import java.util.Arrays;

public class SplitDemo {
    public static void main(String[] args) {
        String line = "abc123def456ghi789jk";
        String[] data = line.split("[0-9]+");

        System.out.println(Arrays.toString(data));


        line = "123.4556.789";
        data = line.split("\\.");
        System.out.println(Arrays.toString(data));


        //如果最开始就是拆分项，那么数组第一个元素为空字符
        //连续两个拆分项，中间也会出现一个空字符串
        //末尾多个连续可拆分项，超i出的空字符倍忽略

        line = "=123=456==78====";
        data = line.split("=");
        System.out.println(Arrays.toString(data));
        System.out.println(data.length);
    }
}
